package cn.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

public class CreatLastWeek {
	public static String[] getLastWeek(String format) {
		long now = new Date().getTime();
		long oneday = 1000 * 60 * 60 * 24;
		if (StringUtils.isBlank(format)) {
			format = "MM-dd";
		}
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		String[] lastweekString = new String[8];
		for (int i = 0; i < lastweekString.length; i++) {
			lastweekString[i] = sdf.format(new Date(now - (7 - i) * oneday));
		}
		return lastweekString;
	}
}
